﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

using System.Collections.Generic;
using System.Runtime.InteropServices;

using Cisoft.Booking.Model;
using Cisoft.Booking.BLL;

using Cisoft.Cisoft3G.Model;
using Cisoft.Cisoft3G.BLL;

public partial class Business_Cisoft3G_InboxManage_AddVote : WebUI.Page.SendMessagePage
{
    #region 引用亿美DLL
    [DllImport("EUCPComm.dll", EntryPoint = "SendSMS")]  //即时发送
    public static extern int SendSMS(string sn, string mn, string ct, string priority);

    [DllImport("EUCPComm.dll", EntryPoint = "SendSMSEx")]  //即时发送(扩展)
    public static extern int SendSMSEx(string sn, string mn, string ct, string addi, string priority);

    [DllImport("EUCPComm.dll", EntryPoint = "SendScheSMS")]  // 定时发送
    public static extern int SendScheSMS(string sn, string mn, string ct, string ti, string priority);

    [DllImport("EUCPComm.dll", EntryPoint = "SendScheSMSEx")]  // 定时发送(扩展)
    public static extern int SendScheSMSEx(string sn, string mn, string ct, string ti, string addi, string priority);
    #endregion

    //亿美产品序列号
    public static string EmeyKey = System.Configuration.ConfigurationManager.AppSettings["EmeyKey"].ToString();
    //亿美产品密码
    public static string EmeyPwd = System.Configuration.ConfigurationManager.AppSettings["EmeyPassword"].ToString();


    private BoxesBO boxesBO = new BoxesBO();
    private BoxesMO boxesMO = new BoxesMO();
    private Hashtable ht = new Hashtable();
    private ShortMessageBO smBO = new ShortMessageBO();
    private ShortMessageMO smMO = new ShortMessageMO();

    #region 页面加载事件
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            BindTree(0, (TreeNode)null);
            //BindDefineGroup();
            BindHour();
            rb_Now.Checked = true;

            //div_Timing.Visible = false;
            //NowOrTiming(false);
        }
    }
    #endregion

    #region 按钮事件
    /// <summary>
    /// 新增事件
    /// </summary>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int flag = -1;
        string strError = "";

        #region 投票选项验证
        for (int i = 3; i <= 20; i++)
        {
            Label lbl_Option = Pan_Options.FindControl("lbl_Option" + i) as Label;
            TextBox tb_Option = Pan_Options.FindControl("tb_Option" + i) as TextBox;
            if (tb_Option.Visible == true)
            {
                if (string.IsNullOrEmpty(tb_Option.Text) && tb_Option1.Text.Trim() != "" && tb_Option2.Text.Trim() != "")
                {
                    lbl_OptionValidator.Text = "<span style='color:red;font-weight:bold;'>请填写投票选项" + i + "</span>";
                    lbl_OptionValidator.Visible = true;
                    return;
                }
                else
                {
                    lbl_OptionValidator.Visible = false;
                }
            }
        }
        #endregion

        //验证时间
        CompareTwoDateValidate();

        if (IsValid)
        {
            #region 发送事件
            //如果是立即发送
            if (rb_Now.Checked)
            {
                VoteMO vMO = new VoteMO();
                string[] mobiles = tb_Mobile.Text.Trim().TrimEnd(',').Split(',');
                //foreach (string mobile in mobiles)
                //{
                //    if (mobile.Length == 11)
                //    {
                ////发送短信
                //try
                //{
                //    vMO = FillVoteMO(GetEMATime(10));
                //    SendMessage(mobile, SendMessageContent() + GetRuleSendTemplate().Replace("投票标识", vMO.VoteID.ToString()));
                //}
                //catch (Exception ex)
                //{
                //    flag = 1;
                //    strError = ex.Message;
                //}
                //写入系统短信表
                //try
                //{
                //    //AddSystemMsg(mobile, tb_VoteContent.Text, DateTime.Now);
                //    AddSystemMsg(mobile, SendMessageContent() + GetRuleSendTemplate(), DateTime.Now);
                //}
                //catch (Exception ex)
                //{
                //    flag = 2;
                //    strError = ex.Message;
                //}
                //if (flag == 1)
                //{
                //    PageError("发送短信失败！错误信息如下：" + strError, Request.RawUrl);
                //}
                //if (flag == 2)
                //{
                //    PageError("写入系统待发失败！错误信息如下：" + strError, Request.RawUrl);
                //}


                //    }
                //}

                vMO = FillVoteMO(DateTime.Now);
               

                //写入投票表
                try
                {
                    new VoteBO().Add(vMO);
                    VoteOptionAdd(vMO.VoteID);
                }
                catch (Exception ex)
                {
                    flag = 3;
                    strError = ex.Message;
                }
                if (flag == -1)
                {
                    //直接发送
                    SendNowSms(mobiles, SendMessageContent() + GetRuleSendTemplate().Replace("投票标识", vMO.VoteID.ToString()));

                    //PageRight("投票新增成功!", "VoteManage.aspx", "返回管理", "");
                    PageRight(ModalPopupExtender2, lblTS, btnBack_ts, "<h4>投票新增成功！</h4>", "VoteManage.aspx");
                }
                if (flag == 3)
                {
                    //PageError("写入系统投票表失败！错误信息如下：" + strError, Request.RawUrl);
                    PageError(ModalPopupExtender2, lblTS, btnBack_ts, "写入系统投票表失败！错误信息如下：" + strError);
                }
            }
            //如果是定时发送
            if (rb_Timing.Checked)
            {
                VoteMO vMO = new VoteMO();
                string date = tb_SendTime.Text;
                date += " " + ddl_SendHour.SelectedValue + ":" + ddl_SendMinite.SelectedValue;
                DateTime time = Convert.ToDateTime(date);
                string[] mobiles = tb_Mobile.Text.Trim().TrimEnd(',').Split(',');
                //foreach (string mobile in mobiles)
                //{
                //    if (IsMobile(mobile))
                //    {
                //        ////发送短信
                //        //try
                //        //{
                //        //    vMO = FillVoteMO(time);
                //        //    SendMessage(mobile, SendMessageContent() + GetRuleSendTemplate().Replace("投票标识", vMO.VoteID.ToString()), time);
                //        //}
                //        //catch (Exception ex)
                //        //{
                //        //    flag = 1;
                //        //    strError = ex.Message;
                //        //}
                //        //写入系统短信表
                //        try
                //        {
                //            //AddSystemMsg(mobile, tb_VoteContent.Text, time);
                //            AddSystemMsg(mobile, SendMessageContent() + GetRuleSendTemplate(), time);
                //        }
                //        catch (Exception ex)
                //        {
                //            flag = 2;
                //            strError = ex.Message;
                //        }
                //        if (flag == 1)
                //        {
                //            PageError("发送短信失败！错误信息如下：" + strError, Request.RawUrl);
                //        }
                //        if (flag == 2)
                //        {
                //            PageError("写入系统短信失败！错误信息如下：" + strError, Request.RawUrl);
                //        }
                //    }
                //}
                //写入投票表

                vMO = FillVoteMO(time);
                try
                {
                    new VoteBO().Add(vMO);
                    VoteOptionAdd(vMO.VoteID);
                }
                catch (Exception ex)
                {
                    flag = 3;
                    strError = ex.Message;
                }
                if (flag == -1)
                {
                    //写入待发表
                    SendTimeSMS(mobiles, SendMessageContent() + GetRuleSendTemplate().Replace("投票标识", vMO.VoteID.ToString()), time);

                    //PageRight("投票新增成功！", "VoteManage.aspx", "返回管理", "");
                    PageRight(ModalPopupExtender2, lblTS, btnBack_ts, "<h4>投票新增成功！</h4>", "VoteManage.aspx");
                }
                if (flag == 3)
                {
                    //PageError("写入系统投票表失败！错误信息如下：" + strError, Request.RawUrl);
                    PageError(ModalPopupExtender2, lblTS, btnBack_ts, "写入系统投票表失败！错误信息如下：" + strError);
                }
            }
            #endregion
        }
    }
    /// <summary>
    /// 返回事件
    /// </summary>
    protected void butrReset_Click(object sender, EventArgs e)
    {
        Response.Redirect("VoteManage.aspx");
    }
    #endregion

    #region 绑定小时时间
    /// <summary>
    /// 绑定小时时间
    /// </summary>
    private void BindHour()
    {
        for (int i = 0; i < 24; i++)
        {
            ListItem li = new ListItem();
            li.Value = i.ToString("00");
            li.Text = i.ToString("00");

            ddl_SendHour.Items.Add(li);
        }

        for (int j = 0; j < 60; j++)
        {
            ListItem item = new ListItem();
            item.Text = j.ToString("00");
            item.Text = j.ToString("00");

            ddl_SendMinite.Items.Add(item);
        }
    }


    /// <summary>
    /// 选中定时发送
    /// </summary>
    protected void rb_Timing_CheckedChanged(object sender, EventArgs e)
    {
        if (rb_Timing.Checked)
        {
            //div_Timing.Visible = true;
            NowOrTiming(true);
        }
    }
    /// <summary>
    /// 选中立即发送
    /// </summary>
    protected void rb_Now_CheckedChanged(object sender, EventArgs e)
    {
        if (rb_Now.Checked)
        {
            NowOrTiming(false);
        }
    }
    #endregion

    #region 写入系统短信表 void AddSystemMsg(string Mobile, string Content, DateTime Time)

    /// <summary>
    /// 写入系统短信表 
    /// </summary>
    /// <param name="Mobile">接收手机号码</param>
    /// <param name="Content">短信内容</param>
    private void AddSystemMsg(string Mobile, string Content, DateTime Time)
    {
        smMO.ShortMessageID = smBO.GetMaxId();
        smMO.ShortMessageRecive = Mobile;
        smMO.ShortMessageSend = "系统";
        smMO.ShortMessageSendTime = Time;
        smMO.ShortMessageType = "投票";
        smMO.ShortMessageContent = Content;
        smMO.ID_FK = -1;

        smBO.Add(smMO);
    }
    #endregion

    #region 填充投票实体类 VoteMO FillVoteMO(DateTime SendTime)
    /// <summary>
    /// 填充投票实体类
    /// </summary>
    /// <param name="SendTime">发送时间</param>
    private VoteMO FillVoteMO(DateTime SendTime)
    {
        DateTime startTime = Convert.ToDateTime(txtDateA.Text + " 00:00:00");
        DateTime endTime = Convert.ToDateTime(txtDateB.Text + " 23:59:59");

        VoteMO vMO = new VoteMO();
        vMO.VoteID = new VoteBO().GetMaxId();
        vMO.VoteName = "";
        vMO.VoteResult = "";
        vMO.VoteContent = tb_VoteContent.Text;//SendMessageContent();
        vMO.VoteStartTime = startTime;
        vMO.VoteEndTime = endTime;
        vMO.VoteSendTime = SendTime;
        vMO.VoteJoin = tb_Mobile.Text;

        return vMO;
    }
    #endregion

    #region 投票选项状态
    protected void ddl_Options_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (Convert.ToInt32(ddl_Options.SelectedValue) >= 2)
        {
            Panel pan_Options = this.Form.FindControl("Pan_Options") as Panel;
            foreach (Control c in pan_Options.Controls)
            {
                if (c is TextBox)
                {
                    string id = c.ID.Replace("tb_Option", "");//c.ID.Substring(c.ID.Length - 1, 1);
                    if (int.Parse(id) <= int.Parse(ddl_Options.SelectedValue))
                    {
                        Label lbl_Option = pan_Options.FindControl("lbl_Option" + id) as Label;
                        lbl_Option.Visible = true;
                        c.Visible = true;
                    }
                    else
                    {
                        Label lbl_Option = pan_Options.FindControl("lbl_Option" + id) as Label;
                        lbl_Option.Visible = false;
                        TextBox tb_Option = c as TextBox;
                        tb_Option.Text = "";
                        c.Visible = false;
                    }
                }
            }
        }
    }
    #endregion

    #region 获取投票选项状态的值 ArrayList GetValueOfOptions()
    /// <summary>
    /// 获取投票选项状态的值
    /// </summary>
    private ArrayList GetValueOfOptions()
    {
        ArrayList al = new ArrayList();

        foreach (Control c in Pan_Options.Controls)
        {
            if (c is TextBox)
            {
                TextBox tb_Option = c as TextBox;
                if (!string.IsNullOrEmpty(tb_Option.Text) && tb_Option.Visible == true)
                {
                    string id = c.ID.Substring(c.ID.Length - 1, 1);
                    string strOption = tb_Option.Text;
                    al.Add(strOption);
                }
            }
        }
        return al;
    }
    #endregion

    #region 获取EMA服务器时间 DateTime GetEMATime()
    private DateTime GetEMATime()
    {
        DateTime time = new DateTime();
        time = new Cisoft.EMA.SMS().GetEMATime();
        time = time.AddSeconds(10);
        return time;
    }

    /// <summary>
    /// 获取EMA服务器时间,加入指定的秒数
    /// </summary>
    /// <param name="Seconds">多少秒后</param>
    private DateTime GetEMATime(int Seconds)
    {
        DateTime time = new DateTime();
        time = new Cisoft.EMA.SMS().GetEMATime();
        time = time.AddSeconds(Seconds);
        return time;
    }
    #endregion

    #region 比较两个时间大小 bool CompareTowTime(DateTime StartTime, DateTime EndTime)
    /// <summary>
    /// 比较两个时间大小,如果开始时间大于结束时间，返回false；如果结束时间大于开始时间，返回true
    /// </summary>
    /// <param name="StartTime">时间1</param>
    /// <param name="EndTime">时间2</param>
    private bool CompareTowTime(DateTime StartTime, DateTime EndTime)
    {
        bool flag = false;
        if (StartTime >= EndTime)
        {
            flag = false;
        }
        else
        {
            flag = true;
        }
        return flag;
    }
    #endregion

    #region 发送的消息 string SendMessageContent()
    private string SendMessageContent()
    {
        ArrayList al = GetValueOfOptions();
        StringBuilder sb = new StringBuilder();
        sb.Append(tb_VoteContent.Text);
        sb.Append(" 选项:");
        if (al.Count > 0)
        {
            for (int i = 1; i <= al.Count; i++)
            {
                sb.Append(i + "、" + al[i - 1].ToString() + " ");
            }
        }
        return sb.ToString();
    }
    #endregion

    #region 验证时间 void CompareTwoDateValidate()
    private void CompareTwoDateValidate()
    {
        if (Convert.ToDateTime(txtDateA.Text) >= Convert.ToDateTime(txtDateB.Text))
        {
            lbl_SendTimeValidator.Text = "<span style='color:red;font-weight:bold;'>结束时间必须大于开始时间！</span>";
            return;
        }
    }
    #endregion

    #region 写入投票选项表 void VoteOptionAdd(int VoteID)
    private void VoteOptionAdd(int VoteID)
    {
        //定义变量是否有异常，默认为无异常
        bool flag = false;
        string strError = "";
        for (int i = 1; i <= 20; i++)
        {
            Label lbl_Option = Pan_Options.FindControl("lbl_Option" + i) as Label;
            TextBox tb_Option = Pan_Options.FindControl("tb_Option" + i) as TextBox;
            if (tb_Option.Visible == true)
            {
                if (!string.IsNullOrEmpty(tb_Option.Text) && tb_Option.Visible == true)
                {
                    VoteOptionBO voBO = new VoteOptionBO();
                    VoteOptionMO voMO = new VoteOptionMO();

                    voMO.VoteOptionID = voBO.GetMaxId();
                    voMO.VoteOptionContent = tb_Option.Text;
                    voMO.VoteOptionNumber = i;
                    voMO.VoteID_FK = VoteID;
                    voMO.VoteCount = 0;

                    try
                    {
                        voBO.Add(voMO);
                    }
                    catch (Exception ex)
                    {
                        //有异常，赋值
                        flag = true;
                        strError = ex.Message;
                    }
                    if (flag)
                    {
                        PageError(strError, Request.RawUrl);
                    }
                }
            }
        }
    }
    #endregion

    #region 获取投票选项内容 string GetVoteOptions()
    private string GetVoteOptions()
    {
        string strVoteOption = "";

        for (int i = 1; i <= 20; i++)
        {
            Label lbl_Option = Pan_Options.FindControl("lbl_Option" + i) as Label;
            TextBox tb_Option = Pan_Options.FindControl("tb_Option" + i) as TextBox;
            if (tb_Option.Visible == true)
            {
                if (string.IsNullOrEmpty(tb_Option.Text))
                {
                    strVoteOption += tb_Option.Text;
                }
            }
        }

        return strVoteOption;
    }
    #endregion

    #region 获取规则表发送模板 string GetRuleSendTemplate()
    private string GetRuleSendTemplate()
    {
        string strSendTemplate = "";

        RuleBO rBO = new RuleBO();
        RuleMO rMO = new RuleMO();

        rMO = rBO.GetModel(" RuleCode like '%TP%'");
        if (rMO != null)
        {
            strSendTemplate = rMO.RuleOrderTemplate;
        }
        return strSendTemplate;
    }
    #endregion

    #region 发送选择时间空间状态
    private void NowOrTiming(bool flag)
    {
        if (flag)
        {
            tb_SendTime.Enabled = true;
            ddl_SendHour.Enabled = true;
            ddl_SendMinite.Enabled = true;
            //CalendarExtender2.Enabled = true;
        }
        else
        {
            tb_SendTime.Enabled = false;
            ddl_SendHour.Enabled = false;
            ddl_SendMinite.Enabled = false;
            //CalendarExtender2.Enabled = false;
        }
    }
    #endregion

    #region 自定义方法立即发送短信
    private void SendNowSms(string[] mobiles,string strContent)
    {
        string strSysError = string.Empty;
        string strEmeyError = string.Empty;

        Cisoft.Cisoft3G.BLL.SentBO bll = new Cisoft.Cisoft3G.BLL.SentBO();
        Cisoft.Cisoft3G.Model.SentMO model = new Cisoft.Cisoft3G.Model.SentMO();

        //string[] mobiles = txtRecive.Text.Trim().TrimEnd(',').Split(',');

        try
        {
            foreach (string s in mobiles)
            {
                strEmeyError = EmeySmsSend(s, strContent);
                if (strEmeyError == "发送成功")
                {
                    model.ST_SentID = bll.GetMaxId();
                    model.ST_Recive = s;
                    model.ST_SentTime = DateTime.Now;
                    model.ST_SmsContent = strContent;
                    model.ST_SmsID = System.Guid.NewGuid().ToString();
                    model.ST_SmsType = "投票调查";
                    bll.Add(model);
                }
            }
        }
        catch (Exception ex)
        {

        }
        //PageRight("投票新增成功!", "VoteManage.aspx", "返回管理", "");
        PageRight(ModalPopupExtender2, lblTS, btnBack_ts, "<h4>投票新增成功！</h4>", "VoteManage.aspx");
    }
    #endregion

    #region 自定义方法定时发送短信
    private void SendTimeSMS(string[] mobiles, string strContent,DateTime time)
    {
        string strError = string.Empty;

        //DateTime time = Convert.ToDateTime(txtTime.Text.Trim() + " " + selectHour.Value + ":" + selectMinite.Value);

        //if (time <= DateTime.Now)
        //{
        //    PageError("定时发送时间必须大于当前时间！", Request.RawUrl);
        //}

        Cisoft.Cisoft3G.BLL.OutboxBO bll = new Cisoft.Cisoft3G.BLL.OutboxBO();
        Cisoft.Cisoft3G.Model.OutboxMO model = new Cisoft.Cisoft3G.Model.OutboxMO();

        //string[] mobiles = txtRecive.Text.Trim().TrimEnd(',').Split(',');

        try
        {
            foreach (string s in mobiles)
            {
                model.OB_OutBoxiD = bll.GetMaxId();
                model.OB_Recive = s;
                model.OB_SendTime = time;
                model.OB_SMContent = strContent;
                model.OB_SmsID = System.Guid.NewGuid().ToString();
                model.RT_Type_FK = 3;

                bll.Add(model);
            }
        }
        catch (Exception ex)
        {
           
        }

        //PageRight("新增投票成功!", "VoteManage.aspx", "返回管理", "");
        PageRight(ModalPopupExtender2, lblTS, btnBack_ts, "<h4>投票新增成功！</h4>", "VoteManage.aspx");
    }
    #endregion

    #region 亿美短信发送方法
    private string EmeySmsSend(string mobile, string content)
    {
        int result = SendSMS(EmeyKey, mobile, content, "5");
        if (result == 1)
            return "发送成功";
        else if (result == 101)
            return "网络故障";
        else if (result == 102)
            return "其它故障";
        else if (result == 0)
            return "失败";
        else if (result == 100)
            return "序列号码为空或无效";
        else if (result == 107)
            return "手机号码为空或者超过1000个";
        else if (result == 108)
            return "手机号码分割符号不正确";
        else if (result == 109)
            return "部分手机号码不正确，已删除，其余手机号码被发送";
        else if (result == 110)
            return "短信内容为空或超长（70个汉字）";
        else if (result == 201)
            return "计费失败，请充值";
        else
            return "其他故障值：" + result.ToString();
    }
    #endregion



    #region 呼叫通讯录
    protected void btnCallContacts_Click(object sender, EventArgs e)
    {
        LinkButton1_Click(sender, e);
    }

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        ModalPopupExtender3.Show();
    }
    #endregion

    #region 通讯录 确定添加联系人
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        ModalPopupExtender3.Hide();
    }
    #endregion

    #region 关闭通讯录
    protected void btnClose_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(hih_right.Value))
        {
            tb_Mobile.Text = string.IsNullOrEmpty(tb_Mobile.Text.Trim()) ? "" : tb_Mobile.Text.TrimEnd(',') + ",";
            tb_Mobile.Text += GetFilterString(hih_right.Value);
            tb_Mobile.Text = tb_Mobile.Text.TrimEnd(',') + ",";
        }
        ModalPopupExtender3.Hide();
    }
    #endregion

    #region 处理通讯录字符串
    private string GetFilterString(string input)
    {
        List<string> strList = new List<string>();
        string strFilter = string.Empty;

        string[] strs = input.TrimEnd(',').Split(',');
        foreach (string s in strs)
        {
            try
            {
                Int64 d = Convert.ToInt64(s.Trim().Substring(s.Length - 11, 11));
                //检查是否有重复字符串
                if (!tb_Mobile.Text.Contains(d.ToString()))
                {
                    strList.Add(d.ToString());
                }
            }
            catch (Exception ex)
            {
                continue;
            }
        }
        if (strList.Count > 0)
        {
            strFilter = string.Join(",", strList.ToArray());
        }

        return strFilter;
    }
    #endregion

    #region 绑定TreeView数据
    //绑定TreeView数据
    private void BindTree(int pid, TreeNode node)
    {
        List<ContactGroupMO> modelList = new ContactGroupBO().GetModelList(" CG_ParentID = " + pid + " order by CG_Order desc");
        foreach (ContactGroupMO model in modelList)
        {
            TreeNode tn = new TreeNode();
            if (node == null)
            {
                tn = new TreeNode();
                tn.Text = "<a style='text-decoration:none;' href='GetContactsHandler.ashx?ContactGroupID=" + model.CG_ContactGroupID + "'>" + model.CG_GroupName + "</a>";
                tn.NavigateUrl = "javascript:void(0);";
                tvContactsGroup.Nodes.Add(tn);
                BindTree(model.CG_ContactGroupID, tn);
            }
            else
            {
                tn = new TreeNode();
                tn.Text = "<a style='text-decoration:none;' href='GetContactsHandler.ashx?ContactGroupID=" + model.CG_ContactGroupID + "'>" + model.CG_GroupName + "</a>";
                tn.NavigateUrl = "javascript:void(0);";
                node.ChildNodes.Add(tn);
                BindTree(model.CG_ContactGroupID, tn);
            }
        }
    }
    //绑定自定义组
    private void BindDefineGroup()
    {
        List<DefineGroupMO> list = new DefineGroupBO().GetModelList("");
        foreach (DefineGroupMO model in list)
        {
            lblDefineGroup.Text += string.Format("<tr><td valign='top'><a style='text-decoration:none;' href='{0}'>{1}</a></td></tr>", "GetContactsHandler.ashx?DefineGroupID=" + model.DG_ID, model.DG_Name);
        }
    }
    #endregion
}
